home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sea_puzzlecrates.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  83 lines

  1. # Jones 3D Cog Script
  2. #
  3. # sea_puzzlecrates.cog
  4. #
  5. # [DS]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message startup
  13.     message    entered
  14.     message    exited
  15.     
  16.     thing        up_crate
  17.     thing        lw_crate1
  18.     thing        lw_crate2
  19.     thing        lw_crate3
  20.     thing        player                    local
  21.  
  22.     flex        crateDistance            local
  23.  
  24.     int            currentCrate            local
  25. end
  26.  
  27. # ========================================================================================
  28. code
  29.  
  30. startup:
  31.     player = GetLocalPlayerThing();
  32.     ClearThingFlags(lw_crate1, 0x40000000);    # Not moveable.
  33.     return;
  34.  
  35. entered:
  36.     if (GetSourceRef() == player)
  37.     {
  38.         if ((GetSenderRef() == lw_crate1) || (GetSenderRef() == lw_crate2) || (GetSenderRef() == lw_crate3) || (GetSenderRef() == up_crate))
  39.         {
  40.             crateDistance = VectorDist(GetThingPos(up_crate), GetThingPos(lw_crate1));
  41.             if (crateDistance <= 0.21)
  42.             {
  43.                 // The top crate is under the top catwalk, so make it non-climbable.
  44.                 ClearThingFlags(up_crate, 0x04000000);    # non-climable
  45.             }
  46.             else
  47.             {
  48.                 SetThingFlags(up_crate, 0x04000000);
  49.             }
  50.  
  51.             // The player is now on top of one of the crates, so mark all 3 bottom crates pushable.
  52.             SetThingFlags(lw_crate1, 0x40000000);    # Now moveable.
  53.             SetThingFlags(lw_crate2, 0x40000000);    # Now moveable.
  54.             SetThingFlags(lw_crate3, 0x40000000);    # Now moveable.
  55.             return;
  56.         }
  57.     }
  58.     return;
  59.  
  60. exited:
  61.     if (GetSourceRef() == player)
  62.     {
  63.         if ((GetSenderRef() == lw_crate1) || (GetSenderRef() == lw_crate2) || (GetSenderRef() == lw_crate3) || (GetSenderRef() == up_crate))
  64.         {
  65.             // The player is no longer on top of any of the crates.  Find out which one is beneath the top crate,
  66.             // and mark it non-pushable.
  67.             for (currentCrate = 0; currentCrate < 3; currentCrate = currentCrate + 1)
  68.             {
  69.                 crateDistance = VectorDist(GetThingPos(up_crate), GetThingPos(lw_crate1[currentCrate]));
  70.                 if (crateDistance <= 0.21)
  71.                 {
  72.                     ClearThingFlags(lw_crate1[currentCrate], 0x40000000);    # Not moveable.
  73.                     return;
  74.                 }
  75.             }
  76.             return;
  77.         }
  78.     }
  79.     return;
  80.  
  81. end
  82.  
  83.